package com.kubepartners.impactmodel.model;

public class Node {
	private String id;
	private String externalID;
	private String description;
	private String label;
	private double vertexCapacity = 1.0;
	private double inducedCapacity = -1.0;
	private boolean inducedSet=false;
	private boolean deliveredSet=false;
	private double deliveredCapacity = -1.0;
	private boolean measurable = false;
	private int decimals = 6;
	
	// Geometry object for storing visual attributes of the node (for yEd)
	private Geometry geometry = new Geometry();
	
	/*
	 * properties that implement error state for the Node;
	 */
	
	private boolean vertexCapacityError =false;
	//sum of weights must be 1
	private boolean incomingLinksError =false;
	private boolean inCycle =false;
	//outgoing_error means that the node is a root and has some outgoing links (this is an error situation)
	private boolean rootError =false;
	private boolean unconnectedError =false;
	private boolean alias =false;
	private boolean multipleLinksError =false;
	
	//Constructor
	public Node(String id){
		this.id=id;
	}
	
	public Node(String id, double vertex_capacity){
		this.id = id;
		this.vertexCapacity = vertex_capacity;
	}
	
	public Node(String id, String description, double vertex_capacity) {
		this.id = id;
		this.description = description;
		this.vertexCapacity = vertex_capacity;
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getExternalID() {
		return externalID;
	}

	public void setExternalID(String externalID) {
		this.externalID = externalID;
	}

	public String getDescription() {
		if (description == null) {
			return "";
		}
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public double getVertexCapacity() {
		return Graph.round(vertexCapacity);
	}

	public void setVertexCapacity(double vertexCapacity) {
		this.vertexCapacity = Graph.round(vertexCapacity);
	}

	public double getInducedCapacity() {
		return Graph.round(inducedCapacity);
	}

	public void setInducedCapacity(double inducedCapacity) {
		this.inducedCapacity = Graph.round(inducedCapacity);
	}

	public double getDeliveredCapacity() {
		return Graph.round(deliveredCapacity);
	}
	
	public void setDeliveredCapacity(double deliveredCapacity) {
		this.deliveredCapacity = Graph.round(deliveredCapacity);
	}

	public String toString() {
		return "Node:" + id;
	}

	public boolean isMeasurable() {
		return measurable;
	}

	public void setMeasurable(boolean measurable) {
		this.measurable = measurable;
	}

	public boolean isVertexCapacityError() {
		return vertexCapacityError;
	}

	public void setVertexCapacityError(boolean vertexCapacity_error) {
		this.vertexCapacityError = vertexCapacity_error;
	}

	public boolean isInCycle() {
		return inCycle;
	}

	public void setInCycle(boolean inCycle) {
		this.inCycle = inCycle;
	}

	public boolean isIncomingLinksError() {
		return incomingLinksError;
	}

	public void setIncomingLinksError(boolean incomingLinksError) {
		this.incomingLinksError = incomingLinksError;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public Geometry getGeometry() {
		return geometry;
	}

	public void setGeometry(Geometry geometry) {
		this.geometry = geometry;
	}

	public boolean isInducedSet() {
		return inducedSet;
	}

	public void setInducedSet(boolean induced_set) {
		this.inducedSet = induced_set;
	}

	public boolean isDeliveredSet() {
		return deliveredSet;
	}

	public void setDeliveredSet(boolean delivered_set) {
		this.deliveredSet = delivered_set;
	}

	public boolean isRootError() {
		return rootError;
	}

	public void setRootError(boolean root_error) {
		this.rootError = root_error;
	}

	public boolean isUnconnectedError() {
		return unconnectedError;
	}

	public void setUnconnectedError(boolean unconnected_error) {
		this.unconnectedError = unconnected_error;
	}

	public boolean isAlias() {
		return alias;
	}

	public void setAlias(boolean alias) {
		this.alias = alias;
	}

	public int getDecimals() {
		return decimals;
	}

	public void setDecimals(int decimals) {
		this.decimals = decimals;
	}
	
	public boolean isMultipleLinksError() {
		return multipleLinksError;
	}

	public void setMultipleLinksError(boolean multiple_links_error) {
		this.multipleLinksError = multiple_links_error;
	}
}
